<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>模板项目管理</title>
<jsp:include page="../../../common/head.jsp"></jsp:include>
<script language="javaScript">	
	// 导出报表
	function exportReport()
	{
		var objarr = new Array(
			["orderField","排序","int","1"],
			["groupField","分组","int","1"]
		);
		if(xj.CheckAll(objarr))
		{
			var orderStr="";
			var groupStr="";
			var orderField = document.getElementsByName("orderField");
			var groupField = document.getElementsByName("groupField");
			var tmp = 11;
			for(var i=0;i<orderField.length;i++)
			{
				if($(orderField[i]).val()!="")
				{
					if(parseInt($(orderField[i]).val())<tmp)
						orderStr=$(orderField[i]).attr("reportDetailId")+","+orderStr;
					else
						orderStr+=$(orderField[i]).attr("reportDetailId")+",";
					tmp = parseInt($(orderField[i]).val());
				}
			}
			tmp = 11;
			for(var i=0;i<groupField.length;i++)
			{
				if($(groupField[i]).val()!="")
				{
					if(parseInt($(groupField[i]).val()<tmp))
						groupStr=$(groupField[i]).attr("reportDetailId")+","+groupStr;
					else
						groupStr+=$(groupField[i]).attr("reportDetailId")+",";
					tmp = parseInt($(groupField[i]).val());
				}
			}
			var str = xjCommon.getValueStr("reportDetailId",",");
			if(str=="")
			{
				alert("请选择要进行导出的字段");
				return;
			}
			window.top.returnValue="${reportId};jxl;"+orderStr+";"+groupStr+";"+str;
			window.top.close();
		}
	}
</script>
	</head>
	<body>
	<div id="body_div">
	<w:ShowTitle name="选择导出项目">
	<w:TitleButton funcName="导出" onClickFunction="exportReport()" urlImg="${ctx}/images/main/add.png"/>
	</w:ShowTitle>
	<div id="body_content">
		<table width="100%" class="listTable">
			<tr>
				<td class="td_title" width="40">
					<span onclick="xjCommon.checkAll('reportDetailId');" >全选</span>
				</td>
				<td class="td_title">
					项目名称
				</td>
				<td class="td_title" width="70">
					数据类型
				</td>
				<td class="td_title" width="70">
					格式化
				</td>
				<td class="td_title" width="40">
					排序
				</td>
				<td class="td_title" width="40">
					分组
				</td>
				<!-- 
				<td class="td_title" width="50">
					聚合
				</td>
				 -->
			</tr>
			<c:forEach items="${datalist}" var="obj">
				<tr>
					<td>
						<c:choose>
							<c:when test="${obj.isDefaultExport eq 'true'}">
								<input type="checkbox" name="reportDetailId" value="${obj.reportDetailId}" checked="checked"/>
							</c:when>
							<c:otherwise>
								<input type="checkbox" name="reportDetailId" value="${obj.reportDetailId}"/>
							</c:otherwise>
						</c:choose>
					</td>
					<td>
						${obj.reportDetailName}
					</td>
					<td>
						<c:choose>
							<c:when test="${obj.dataType eq 'String'}">字符</c:when>
							<c:when test="${obj.dataType eq 'Date'}">日期</c:when>
							<c:when test="${obj.dataType eq 'Double'}">双精度数值</c:when>
							<c:when test="${obj.dataType eq 'Long'}">整数</c:when>
							<c:when test="${obj.dataType eq 'Dict'}">数据字典</c:when>
						</c:choose>
					</td>
					<td>
						${obj.dataPattern}
					</td>
					<td>
						<input type="text" style="width:30px" name="orderField" reportDetailId="${obj.attributeName}＃${obj.dataType}"/>
					</td>
					<td>
						<input type="text" style="width:30px" name="groupField" reportDetailId="${obj.attributeName}＃${obj.dataType}＃${obj.dataPattern}"/>
					</td>
					<!-- 
					<td>
						<select name="aggregate" class="selectLengthAuto">
							<option value="">无</option>
							<option value="sum">加和</option>
							<option value="count">总数</option>
							<option value="max">最大</option>
							<option value="min">最小</option>
							<option value="avg">平均</option>
						</select>
					</td>
					 -->
				</tr>
			</c:forEach>
		</table>
	</div>
	</div>
	</body>
</html>




